﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.Data;

namespace zevenseas.LifeCycleManagement.Utilities
{
    public class SiteLifeCycleSettings : SPPersistedObject
    {
        [Persisted]
        public bool mailOwner;
        [Persisted]
        public bool lockSite;
        [Persisted]
        public bool deleteSite;
        [Persisted]
        public int emailSpan;
        [Persisted]
        public int lockSpan;
        [Persisted]
        public int deleteSpan;
        [Persisted]
        public string emailSubject;
        [Persisted]
        public string emailBody;
        [Persisted]
        public string emailTo;

        [Persisted]
        public bool lastContentModifiedDate;

        [Persisted]
        public bool lastSecurityModifiedDate;

        [Persisted]
        public bool lastUsageDate;

        [Persisted]
        public int unusedSpan;

        [Persisted]
        public LCMStatus status;

        public SiteLifeCycleSettings() { }

        public SiteLifeCycleSettings(string name, SPPersistedObject parent, Guid id) : base(name, parent, id)
        {
        }
    }

    public class SiteDeletionCaptureSettings : SPPersistedObject
    { 
        [Persisted]
        public bool dateTime;
        [Persisted]
        public bool folderSitecollection;
        [Persisted]
        public bool folderWeb;
        [Persisted]
        public bool logInSharePoint;
        [Persisted]
        public string backupLocation;
   
        public SiteDeletionCaptureSettings() { }

        public SiteDeletionCaptureSettings(string name, SPPersistedObject parent, Guid id) : base(name, parent, id)
        {
        }
    }

    public class ActionTimerJobStatus : SPPersistedObject
    { 
        [Persisted]
        public DateTime LastRunTime;

        public ActionTimerJobStatus() { }

        public ActionTimerJobStatus(string name, SPPersistedObject parent, Guid id)
            : base(name, parent, id)
        {
        }
    }

    public class GatherTimerJobStatus : SPPersistedObject
    {
        [Persisted]
        public DateTime LastRunTime;

        public GatherTimerJobStatus() { }

        public GatherTimerJobStatus(string name, SPPersistedObject parent, Guid id)
            : base(name, parent, id)
        {
        }
    }

    public class EventHandlerStatus : SPPersistedObject
    {
        [Persisted]
        public int WebsProcessed;

        [Persisted]
        public int FeatureInstalled;

        [Persisted]
        public int FeatureAlreadyInstalled;

        public EventHandlerStatus() { }

        public EventHandlerStatus(string name, SPPersistedObject parent, Guid id)
            : base(name, parent, id)
        {
        }
    }

    public class DeletedSite : SPPersistedObject
    {
        [Persisted]
        public string Title;

        [Persisted]
        public bool SiteCollection;

        [Persisted]
        public bool Web;

        [Persisted]
        public string Url;

        [Persisted]
        public string FileName;

        [Persisted]
        public string FileLocation;

        [Persisted]
        public DateTime Date;

        [Persisted]
        public string WebApplication;

        public DeletedSite() { }

        public DeletedSite(string name, SPPersistedObject parent, Guid id)
            : base(name, parent, Guid.NewGuid())
        {
        }
    }

    public class DeletedSiteCollection : SPPersistedChildCollection<DeletedSite>
    {
        public DeletedSiteCollection(SPWebApplication webApplication)
            : base(webApplication)
        {

        }
    }
}


